package com.crazymakercircle.innerlock;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

/**
 * @Description
 * @Date 2021/8/2
 * @Created by Jonathan
 */
@Slf4j
public class Test {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        log.info("hello world");
        ExecutorService service = Executors.newCachedThreadPool();
        Future<Integer> future = service.submit(() -> {
            log.info("--");
            TimeUnit.SECONDS.sleep(100);
            return 100;
        });
        Integer integer = future.get();
        log.info("ret:{}", integer);

    }
}
